package cn.zyl.demo.common.exception;

import cn.zyl.demo.common.enums.MsgEnum;
import cn.zyl.demo.common.permanent.MsgProperties;

/**
 * DateToolException类说明:
 *
 * @author wsz
 * @version v1.0
 * @date 2020-07-22
 */
public class DateToolException extends RuntimeException{
    public DateToolException(String msg){ super(msg);}
    public DateToolException(String msg,Throwable e){super(msg,e);}
    public DateToolException(Throwable e){super(e);}
    /** 增加异常抛出函数 */
    public static void isTrueThrow(boolean boo,String msg)throws DateToolException{
        if(boo){throw new DateToolException(msg);}
    }
    public static void isTrueThrow(boolean boo, MsgEnum msg)throws DateToolException{
        if(boo){throw new DateToolException(MsgProperties.get(msg));}
    }
    public static void isNullThrow(Object o,String msg)throws DateToolException{
        isTrueThrow(null==o,msg);
    }
    public static void isNullThrow(Object o, MsgEnum msg)throws DateToolException{
        isTrueThrow(null==o,msg);
    }
}
